const jwt = require("jsonwebtoken");
const expressJWT = require("express-jwt");
const { secretKey, timeout, unless } = require("../../config/token.config");

/**
 * 用户认证 JWT
 */
class YJwt{
  constructor() {}

  /**
   * 
   * @param {*} userinfo：登录的用户信息
   */
  static encodeToken(username) {
    return jwt.sign(
      { username }, 
      secretKey, 
      { expiresIn: timeout }
    )
  }
}

module.exports = YJwt;
